using System;
using System.Collections.Generic;
using System.Text;

namespace XProject.Entity
{
   public class Email
    {
       int id;
       int contactID;
       string emailAddress;
       bool isChanged = true;
       #region constructors
       public Email() { emailAddress = ""; this.id = -1; }
       public Email(string _email) { this.emailAddress = _email; this.id = -1; }
       public Email(int _emailId, string _email):this(_email)
       {
           this.id = _emailId;
       }
       #endregion
       #region properties
       public int EmailID
       {
           get { return id; }
           set { id = value; }
       }
       public int ContactID
       {
           get { return contactID; }
           set { contactID = value; }
       }
       public string EmailAddress
       {
           get { return emailAddress; }
           set { emailAddress = value; isChanged = true; }
       }
       public bool IsChanged
       {
           get { return isChanged; }
           set { isChanged = value; }
       }
       #endregion

       public override bool Equals(object obj)
       {
           Email email = obj as Email;
           if (email == null) return false;
           return this.emailAddress==email.EmailAddress;
       }
       public override int GetHashCode()
       {
           return base.GetHashCode();
       }
      
   }
}
